<?php

class Career_selection extends CI_Controller {

    var $user_id;

    function __construct() {
        parent::__construct();

        $this->user_id = 1;


        //Set folder to load view (under View for)
        $this->layouts->set_view_folder('career_selection');

        //Load model
        $this->load->model('career_selection_model');

        //load js and css
        $this->layouts->set_css('datatable/demo_table');
        $this->layouts->set_css('datatable/demo_table_jui');
        $this->layouts->set_css('datatable/smoothness/jquery-ui-1.8.4.custom');
        $this->layouts->set_js('jquery.dataTables');
        $this->layouts->set_js('js_careerselection/career');

        //Send base url to view for processing
        $this->view_data['base_url'] = base_url();
    }
    
    function index(){
        $this->display_career();
    }

    function display_career() {
        $data['categorylist'] = $this->career_selection_model->categorylist();
        $data['mycareer'] = $this->career_selection_model->mycareer($this->user_id);
        $data['filtercar'] = $this->career_selection_model->filtercar();
        $this->layouts->view('career_home', $data);
    }

    function searchkeyword() {
        $data['searchkey'] = $this->career_selection_model->searchkey($keyword, $cate);
        $data['mycareer'] = $this->career_selection_model->mycareer($this->user_id);
        $this->layouts->view('career_searchkey', $data);
    }

    function searchcategory() {
        $data['searchcate'] = $this->career_selection_model->searchcate($cate);
        $data['categorylist'] = $this->career_selection_model->categorylist();
        $data['mycareer'] = $this->career_selection_model->mycareer($this->user_id);
        $this->layouts->view('career_searchcate', $data);
    }

    function searchpersonality() {
        $this->load->model('career_display_model');
        $data['searchpersonality'] = $this->career_selection_model->searchpersonality();
        $data['mycareer'] = $this->career_selection_model->mycareer($this->user_id);
        $this->layouts->view('career_searchper', $data);
    }

    function searchfilter() {
        $data['careerper'] = $this->career_selection_model->careerper($cate, $keyword);
        $data['categorylist'] = $this->career_selection_model->categorylist();
        $data['mycareer'] = $this->career_selection_model->mycareer($this->user_id);
        $this->layouts->view('career_filterlist', $data);
    }

// deletion


    function deletecareer() {
        $this->career_selection_model->entry_delete($this->user_id);
        redirect('career_selection/display_career');
    }

//selection of career
    function confirmSelection() {
        $ids = $this->input->post('career_id');
        foreach ($ids as $id) {
            $this->career_selection_model->confirmSelectionModel($id,$this->user_id);
        }
        redirect('career_selection/display_career');
    }

    function selcareer() {
        $data['selected'] = $this->career_selection_model->selCareerModel();
        $this->layouts->view('career_selected', $data);
    }

}

?>
